<template>
	<div class="container">
		<!-- 头部标题栏 -->
		<h3 class="header-title clearfix">
			<span class="mox"></span>
			<p @click="markshow=true">{{$store.getters.getPageTitle}}</p>
			<p v-show="!markshow">-</p>
			<p v-show="index==1&&!markshow" :class="index==1?'on-active':'2'" @click="getTabByType1">沟通数量</p>
			<p v-show="index==2&&!markshow" :class="index==2?'on-active':'2'" @click="getTabByType2">通知面试人数</p>
			<p v-show="index==3&&!markshow" :class="index==3?'on-active':'2'" @click="getTabByType3">实到面试人数</p>
			<p v-show="index==4&&!markshow" :class="index==4?'on-active':'2'" @click="getTabByType4">通知复试人数</p>
			<p v-show="index==5&&!markshow" :class="index==5?'on-active':'2'" @click="getTabByType5">实到复试人数</p>
			<p v-show="index==6&&!markshow" :class="index==6?'on-active':'2'" @click="getTabByType6">录取人数</p>
			<p v-show="index==7&&!markshow" :class="index==7?'on-active':'2'" @click="getTabByType7">到岗人数</p>
			<!-- <p class="fr el-icon-plus" @click="function(){return openInputDialog('新增')}" v-if="title.add"> 新增</p> -->
			<p class="fr output" @click="OverviewOut"> 导出</p>
			<!-- <p class="fr el-icon-arrow-left" @click="goBack" v-else> 返回</p> -->
		</h3>
		<!-- 主体部分-管理员列表页面 -->
		<div class="search">
			<el-form ref="form" :model="form" label-width="100px" :inline="true">
				<el-form-item label="发布时间">
					<el-date-picker type="date" placeholder="选择日期" v-model="form.startCreatTime"
						value-format="yyyy-MM-dd" style="width:180px;" @change="saveData">
					</el-date-picker>-
					<el-date-picker type="date" placeholder="选择日期" v-model="form.endCreatTime" value-format="yyyy-MM-dd"
						@change="saveData" style="width:180px;">
					</el-date-picker>
				</el-form-item>
				<el-form-item label="公司名称">
					<el-input v-model="form.companyName" @click="saveData" placeholder="请输入公司名称"></el-input>
				</el-form-item>
				<el-form-item label="岗位名称">
					<el-input v-model="form.positionName" @click="saveData" placeholder="请输入岗位名称"></el-input>
				</el-form-item>
				<el-form-item label="操作时间">
					<el-date-picker type="date" placeholder="选择日期" @change="saveData" v-model="form.startOperationTime"
						value-format="yyyy-MM-dd" style="width:180px;">
					</el-date-picker>-
					<el-date-picker type="date" placeholder="选择日期" @change="saveData" v-model="form.endOperationTime"
						value-format="yyyy-MM-dd" style="width:180px;">
					</el-date-picker>

				</el-form-item>
				<el-form-item label="招聘渠道">
					<el-select v-model="form.recruitmentChannel" style="width: 400px;" clearable @change="saveData">
						<el-option v-for="item in list" :value="item" :label="item"></el-option>

					</el-select>
				</el-form-item>
				<el-form-item label="求职者姓名">
					<el-input v-model="form.name" placeholder="请输入求职者姓名" @blur="saveData"></el-input>
				</el-form-item>
				<el-form-item label="录入专员姓名">
					<el-input v-model="form.inputUsername" placeholder="请输入录入专员姓名" @blur="saveData"></el-input>
				</el-form-item>
				<el-form-item>
					<el-button type="primary" class="btn" @click="getList(form)">查询</el-button>
				</el-form-item>
			</el-form>
		</div>

		<comTable :options="tableData" @stopProject="stopProject" @getTabByType1="getTabByType1" v-show="markshow"
			class="overview" @changeCur="changeCur" @getTabByType2="getTabByType2" @getTabByType3="getTabByType3"
			@getTabByType4="getTabByType4" @getTabByType5="getTabByType5" @getTabByType6="getTabByType6"
			@getTabByType7="getTabByType7"></comTable>

		<comTable :options="tableDataByuser" @lookRemark="function(data){return openDetailsDialog('备注',data)}"
			@lookResume="lookResume" v-show="!markshow"></comTable>
		<perMgAddRemarks ref="remark" :options="remarksData" @subRemarks="subRemarks"></perMgAddRemarks>
		<!-- 简历模板弹窗 -->
		<comResume :options="remuseData"></comResume>
		<comDetails :options="detailsData" @getDetailsList="getDetailsList"></comDetails>
		<!-- 分页器 -->
		<div class="pageBox">
			<el-pagination @size-change="handleSizeChange" @current-change="pageChange" :current-page="cur"
				:page-sizes="[10, 20, 30, 50, 100]" :page-size="pageSize"
				layout="total, sizes, prev, pager, next, jumper" :total="totalNum" background></el-pagination>
		</div>
	</div>
</template>

<script>
	export default {
		components: {
			comTable: () => import("../commonComponents/comTable.vue"),
			comResume: () => import("../commonComponents/comResume.vue"),
			perMgAddRemarks: () => import("../pageComponents/perMgAddRemarks.vue"),
			comDetails: () => import("../commonComponents/comDetails.vue"),


		},


		props: {
			options: {
				require: true,
				type: Object
			}

		},
		data() {
			return {
				index: '',
				projectId: '',
				title: {
					add: true, //新增按钮
				},
				remuseData: {
					showDialog: false, //显示弹窗
					title: '简历列表', //标题
					list: [
						/* {
							title: '一、简历',
						} */
					],
					userInfo: {}, //当前被操作人员信息
				},
				markshow: true,
				tableDataByuser: {
					list: [{
							title: '姓名',
							prop: 'name',
							isClick: false
						},
						{
							title: '电话',
							prop: 'telnum',
							isClick: false
						},
						{
							title: '性别',
							prop: 'sex',
							isClick: false
						},
						{
							title: '操作时间',
							prop: 'updateTime',
							isClick: false
						},
						{
							title: '备注',
							prop: 'lookRemark',
							eventName: 'lookResume',
							isClick: true
						},
						{
							title: '简历',
							prop: 'lookRemark',
							isClick: true,
							eventName: 'lookResume'
						}
					],
					noOperation: false, //是否有操作项
					operation: [ //操作项内容
						// {name:'查看明细',isBtn:false,title:'detailsView'},
					],
					data: [
						/* {
							projectName: '物险',						//项目名称
							createTime: '2020-1-55',					//新增时间
							entryNumber: 20,							//入职量
							turnover: '20%',							//离职率
							suspendTime: '2020-5-12',					//中止时间
							projectRemark: 'xxx',						//备注
							suspendStatus: '已中止',						//操作
						}, */
					]
				},



				tableData: {
					list: [{
							title: '公司名称',
							prop: 'companyName',
							isClick: false
						},
						{
							title: '岗位名称',
							prop: 'positionName',
							isClick: false
						},
						{
							title: '招聘渠道',
							prop: 'recruitmentChannel',
							isClick: false
						},
						{
							title: '发布时间',
							prop: 'createTime',
							isClick: true,
							sortable: true,
							byOrder: 'byTimeOrder'
						},
						{
							title: '沟通数量',
							prop: 'communication',
							isClick: true,
							sortable: true,
							eventName: 'getTabByType1',
						},
						{
							title: '通知面试人数',
							prop: 'informInterview',
							isClick: true,
							sortable: true,
							eventName: 'getTabByType2',
						},
						{
							title: '实到面试人数',
							prop: 'attendanceInterview',
							isClick: true,
							sortable: true,
							eventName: 'getTabByType3',
						},
						{
							title: '通知复试人数',
							prop: 'secondInterview',
							isClick: true,
							sortable: true,
							eventName: 'getTabByType4',
						},
						{
							title: '实到复试人数',
							prop: 'attendanceSecondInterview',
							isClick: true,
							sortable: true,
							eventName: 'getTabByType5',
						},
						{
							title: '录取人数',
							prop: 'matriculate',
							isClick: true,
							sortable: true,
							eventName: 'getTabByType6',
						},

						{
							title: '到岗人数',
							prop: 'entry',
							isClick: true,
							sortable: true,
							eventName: 'getTabByType7',
						},

						{
							title: '状态',
							prop: 'suspendStatus1',
							isClick: true
						},
					],
					noOperation: false, //是否有操作项
					operation: [ //操作项内容
						// {name:'查看明细',isBtn:false,title:'detailsView'},
					],
					data: [
						/* {
							projectName: '物险',						//项目名称
							createTime: '2020-1-55',					//新增时间
							entryNumber: 20,							//入职量
							turnover: '20%',							//离职率
							suspendTime: '2020-5-12',					//中止时间
							projectRemark: 'xxx',						//备注
							suspendStatus: '已中止',						//操作
						}, */
					]
				},




				//公共信息
				commonMsg: {
					searchData: {}, //当前的搜索条件
					userInfo: {}, //当前搜索人信息
				},
				/* 搜索列表 */
				search: {
					userShow: true, //姓名
					telShow: true, //电话号码
				},
				form: {
					startOperationTime: '',
					startCreatTime: '',
					positionName: '',
					startOperationTime: '',
					suspendStatus: '',
					endPperationTime: '',
					recruitmentChannel: '',
					endCreatTime: '',
					name: '',
					data1: '',
					data2: '',
					name: '',
					companyName: '',

				},
				/* 招聘人员管理列表数据 */
				tableList: {
					list: [{
							title: '姓名',
							prop: 'name',
							isClick: false
						},
						{
							title: '账号',
							prop: 'accountNumber',
							isClick: false
						},
						{
							title: '手机号',
							prop: 'telnum',
							isClick: false
						},
						{
							title: '数据量',
							prop: 'dataSize',
							isClick: false
						},
						{
							title: '上次操作时间',
							prop: 'operatorTime',
							isClick: false
						},
						{
							title: '起始时间',
							prop: 'createTime',
							isClick: false
						}
					],
					noOperation: true, //是否有操作项
					operation: [ //操作项内容
						{
							name: '查看明细',
							isBtn: false,
							title: 'detailsView'
						},
						{
							name: '移交',
							isBtn: false,
							title: 'openInputDialog'
						}
					],
					data: [
						/* {
							name: '老王',								//姓名
							accountNumber:'admin',						//账号
							telnum: '13434343434',						//手机号
							dataSize: '50',								//数据量
							operatorTime: '2020-20-11',					//上次操作时间
							createTime: '2020-1-15',					//起始时间
						} */
					]
				},

				/* 项目详情搜索条件 */
				salesmanSearch: {
					userShow: true, //姓名
					telShow: true, //电话号码
					tagShow: true, //标注
					sexShow: true, //性别
					ageShow: true, //年龄
					educationShow: true, //学历
					addressShow: true, //现住址
					workStatusShow: true, //工作状态
					postShow: true, //岗位
					projectShow: true, //项目归属
					entryShow: true, //录入时间
				},
				list: [],
				/* 项目详情数据列表 */
				administrators: {
					list: [{
							title: '标注',
							prop: 'arrange',
							isClick: false
						},
						{
							title: '姓名',
							prop: 'name',
							isClick: false
						},
						{
							title: '手机号',
							prop: 'telnum',
							isClick: false
						},
						{
							title: '性别',
							prop: 'sex',
							isClick: false
						},
						{
							title: '年龄',
							prop: 'age',
							isClick: false
						},
						{
							title: '学历',
							prop: 'education',
							isClick: false
						},
						{
							title: '籍贯',
							prop: 'nativePlace',
							isClick: false
						},
						{
							title: '现住址',
							prop: 'presentAddress',
							isClick: false
						},
						{
							title: '期望职位',
							prop: 'position',
							isClick: false
						},
						{
							title: '工作状态',
							prop: 'workStatus',
							isClick: false
						},
						{
							title: '项目归属',
							prop: 'projectBelongs',
							isClick: false
						},
						{
							title: '入职时间',
							prop: 'hiredate',
							isClick: false
						},
						{
							title: '最新备注',
							prop: 'newRemarks',
							isClick: true,
							eventName: 'addRemarks'
						},
						{
							title: '历史备注',
							prop: 'oldRemarks',
							isClick: false
						},
						{
							title: '录入时间',
							prop: 'createTime',
							isClick: false
						},
						{
							title: '简历',
							prop: 'resume',
							isClick: true,
							eventName: 'openResume'
						},
					],
					noOperation: true, //是否有操作项
					operation: [ //操作项内容
						{
							name: '修改明细查看',
							isBtn: false,
							title: 'openDetailsDialog'
						},
						{
							name: '所有备注查看',
							isBtn: false,
							title: 'openRemarksDialog'
						}
					],
					data: [
						/* {
							arrange: '已安排',
							name: '徐凤年',
							telnum: '156565656',
							position: '月嫂',
							workStatus: '在职',
							projectBelongs: '发财网络科技有限公司',
							newRemarks: 'xxx',
							oldRemarks: 'xxx',
							createTime: '2020-1-55',
							resume: '查看简历'
						}, */
					]
				},
				/* 弹窗数据 */
				inputData: {
					showDialog: false, //显示弹窗
					title: '账户数据移交', //标题
					type: '', //弹窗类型
					dialogContent: [{
							title: '交接账号:',
							value: 'account'
						},
						{
							title: '管理员密码:',
							value: 'password'
						},
					],
					form: {
						account: '', //交接账户
						password: '', //密码
					},
					userInfo: {}, //被操作人员信息
					tips: '', //提示语
				},
				/* 明细弹窗数据 */
				detailsData: {
					showDialog: false, //显示弹窗
					title: '修改明细', //标题
					type: '', //明细还是备注
					list: [ //数据列表
						/* {	
							createTime: '2020年09月11日10:41:54',						//标题
							comment: '修改手机号码：15202120781 为 手机号码：120383774748',	//内容
						}, */
					],
					userInfo: {}, //当前被操作人员的信息
					totalNum: 0, //数据量
				},
				/* 添加备注弹窗 */
				remarksData: {
					showDialog: false, //显示弹窗
					title: '查看备注', //标题
					userInfo: {}, //当前被操作人员信息
				},
				list: [],
				/* 简历模板数据 */


				/* 分页功能数据 */
				cur: 1,
				pageSize: 10,
				totalNum: 0, //总共有多少条数据,根据这个数据去适配页数
			}
		},
		created() {
			this.init();
			this.getSearchList()
			if (localStorage.getItem('saveData')) {
				this.form = JSON.parse(localStorage.getItem('saveData'))
				this.getList(this.form)
			} else {
				let formData = {
					startOperationTime: '',
					startCreatTime: '',
					positionName: '',
					startOperationTime: '',
					suspendStatus: '',
					endPperationTime: '',
					recruitmentChannel: '',
					endCreatTime: '',
					name: '',
					data1: '',
					data2: '',
					name: '',
					companyName: '',

				}
				localStorage.setItem('saveData', JSON.stringify(formData))
				this.getList()

			}

		},

		 
		directives: {
			// color: {
			//   // 指令的定义
			//   inserted: function (el,binding) {
			//    if(this.index==binding.value){
			//  el.addClass('.on-active')
			// }
			//   }
			// }	
		},
		watch: {
			application() {
				this.markshow = this.$store.state.telMark
				console.log(this.$store.state.telMark);
			}
		},
		methods: {
			byTimeOrder(data) {
				console.log(data);
				console.log(222222222);
			},
			saveData() {
				localStorage.setItem('saveData', JSON.stringify(this.form))
			},





			getSearchList(mark) {
				let data = {}
				let url = '/v1/librarian/recruitmentChannelList'

				this.$telAxios.get(url, data).then(res => {
					this.list = res.data.data
				})
			},
			openDetailsDialog(type, data) {
				console.log(type);
				console.log(data);
				this.detailsData.type = type;
				this.detailsData.userInfo = data;
				this.detailsData.showDialog = true;
				this.detailsData.title = type == '明细' ? '修改明细' : '备注';
				this.getDetailsList({
					cur: 1,
					pageSize: 10
				});
			},

			lookResume(row) {
				let data = {
					librarianId: row.librarianId,
				}
				this.$telAxios.post('v1/librarian/selectFlexibileResumeList', data).then(res => {
					console.log(res);
					this.remuseData.showDialog = true
					this.remuseData.list = res.data.data
				})
			},
			lookRemark(row) {
				this.remarksData.showDialog = true
				console.log(row);
				let data = {
					librarianId: row.librarianId
				}
				this.$telAxios.post('/v1/librarian/selectPostscriptVoList', data).then(res => {
					console.log(res);
					this.remarksData.textarea = res.data.data.plist[0].comment
				})

			},
			//导出
			OverviewOut() {
				console.log(this.index);
				let data = {
					pageNum: '1',
					pageSize: '10',
					projectId: this.projectId
				}
				data = Object.assign(data, this.form);
				let url = 'https://fcapp.fcw-china.com/app/v1/librarian/projectOverviewOut';
				if (!this.markshow) {
					url = 'https://fcapp.fcw-china.com/app/v1/librarian/projectOverviewByTypeOut'
					data.suspendStatus = this.index + ''
					data.workStatus = this.index + ''
				}
				// data.Object.assign(data,this.form)
				var d = new Date();
				this.$axios({
						url: url,
						method: "post",
						responseType: "blob",
						data: data
					})
					.then((res) => {
						console.log(res);
						var blob = new Blob([res.data]);
						var downloadElement = document.createElement("a");
						var href = window.URL.createObjectURL(blob); //创建下载的链接
						downloadElement.href = href;
						downloadElement.download = `项目概览表.xls`;
						if (!this.markshow) {
							downloadElement.download = `招聘资料概览表.xls`;
						}
						document.body.appendChild(downloadElement);
						downloadElement.click(); //点击下载
						this.$message({
							type: "success",
							message: "下载成功！",
						});
						document.body.removeChild(downloadElement); //下载完成移除元素
						window.URL.revokeObjectURL(href); //释放掉blob对象
					})
					.catch((res) => {
						console.log(res)
					});
			},
			getTabByType(index) {
				this.$router.push({
					path: '/home/overviewItem',
					query: {
						workStatus: index,
						projectId: this.projectId,
					}
				})
				this.markshow = false
				this.index = index
				let data = {
					pageNum: '1',
					pageSize: '10',
					workStatus: index,
					projectId: this.projectId
				}
				data = Object.assign(data, this.form);
				this.$telAxios.post('v1/librarian/projectOverviewByType', data).then(res => {
					this.tableDataByuser.data = res.data.data.plist
					this.totalNum = parseInt(res.data.data.totalNum)
					this.tableDataByuser.data.forEach(item => {
						item.lookRemark = '查看'
					})
					console.log(res);
				})
			},

			getTabByType1(row) {
				console.log(row);
				this.projectId = row.projectId


				this.getTabByType(1);
			},

			getTabByType2(row) {
				this.projectId = row.projectId
				this.getTabByType(2);
			},
			getTabByType3(row) {
				this.projectId = row.projectId
				this.getTabByType(3);
			},
			getTabByType4(row) {
				this.projectId = row.projectId
				this.getTabByType(4);
			},
			getTabByType5(row) {
				this.projectId = row.projectId
				this.getTabByType(5);
			},
			getTabByType6(row) {
				this.projectId = row.projectId
				this.getTabByType(6);
			},
			getTabByType7(row) {
				this.projectId = row.projectId
				this.getTabByType(7);
			},

			stopProject() {},
			//初始化
			init() {
				this.goBack();
			},
			//获取招聘人员管理数据列表-管理员列表/业务员项目列表
			getList(form) {
				if (this.title.add) {
					//管理员列表
					console.log(form);
					let params = {
						pageNum: this.cur,
						pageSize: this.pageSize,
						sortType: 0
					};

					let url = '/v1/librarian/projectOverview'
					if (!this.markshow) {
						this.getTabByType(this.index)
						return
					}
					if (form) {
						params = Object.assign(params, form);
					}
					this.$telAxios.post(url, params).then(res => {
						console.log(res);
						if (res.data.code === 1) {
							let result = res.data.data.list;
							let counts  =res.data.data
							console.log(counts);
							result.forEach(item => {
								item.edit = '编辑'
								if (item.suspendStatus == '1') {
									item.suspendStatus1 = '紧急'
								} else if (item.suspendStatus == '2') {
									item.suspendStatus1 = '正常'
								} else {
									item.suspendStatus1 = '暂停'
								}
							})
							this.tableData.data = result;
							this.tableData.list.forEach(res=>{
								console.log(res);
								if(res.prop=='communication'){
									res.title='沟通数量'+`(${counts.communicationCount})`
								} 
								if(res.prop=='informInterview'){
									res.title='面试通知人数'+`(${counts.informInterviewCount})`
								} 
								if(res.prop=='attendanceInterview'){
									res.title='实到面试人数'+`(${counts.attendanceInterviewCount})`
								} 
								if(res.prop=='secondInterview'){
									res.title='通知复试人数'+`(${counts.secondInterviewCount})`
								} 
								if(res.prop=='attendanceSecondInterview'){
									res.title='实到复试人数'+`(${counts.attendanceSecondInterviewCount})`
								} 
								if(res.prop=='matriculate'){
									res.title='录取人数'+`(${counts.matriculateCount})`
								} 
								if(res.prop=='entry'){
									res.title='到岗人数'+`(${counts.entryCount})`
								} 
								 
							})
							
							
							
							this.tableData.data.forEach(item => {
								if (item.recruitmentList.length > 0) {
									item.recruitmentList.forEach(data => {
										item.recruitmentChannel += data + '\n'
									})
									item.recruitmentChannel = item.recruitmentChannel.substring(9)
								}
							})
							console.log(res.data.data);
							this.totalNum = Number(res.data.data.totalNum);
						} else {
							this.$message({
								message: res.data.message,
								type: 'warning'
							})
						}
					})


				} else {
					//业务员详情列表
					params.userId = this.commonMsg.userInfo.userId;
					this.$telAxios.post('/v1/librarian/selectLibrarianList', params).then(res => {
						console.log(res);
						if (res.data.code === 1000) {
							let result = res.data.data;
							this.administrators.data = result.llist;
							result.llist.forEach(item => {
								item.resume = '查看简历';
								if (item.plist.length == 0) {
									item.newRemarks = '-';
									item.oldRemarks = '-';
								} else if (item.plist.length == 1) {
									item.newRemarks = item.plist[0].comment;
									item.oldRemarks = '-';
								} else {
									item.newRemarks = item.plist[0].comment;
									item.oldRemarks = item.plist[1].comment;
								}
							})
							this.totalNum = Number(result.totalNum);
						} else {
							this.$message({
								message: res.data.message,
								type: 'warning'
							})
						}
					})
				}


			},
			//返回
			goBack() {
				this.title.add = true;
				localStorage.setItem('pageTitle', '概览');
				this.$store.dispatch('setPageTitle', localStorage.getItem('pageTitle'));
			},
			//管理员条件搜索
			searchData(data) {
				console.log(data);
				this.commonMsg.searchData = data;
				this.getList(data);
			},
			//查看明细
			detailsView(data) {
				console.log(data);
				this.commonMsg.userInfo = data;
				this.title.add = false;
				localStorage.setItem('pageTitle', '概览——' + data.name);
				this.$store.dispatch('setPageTitle', localStorage.getItem('pageTitle'));
				this.$nextTick(() => {
					this.$refs.search.clearData();
					this.getList(this.commonMsg.searchData);
				});

			},
			//提交弹窗的数据
			subData(data) {
				console.log(data);
				if (this.inputData.type == '新增') {
					this.$telAxios.post('/v1/librarian/selectUserInfoExit', {
						accountNumber: data.accountNumber
					}).then(res => {
						console.log(res);
						if (res.data.code === 1000) {
							if (res.data.data === false) {
								this.$telAxios.post('/v1/librarian/insertFlexibileUser', data).then(res => {
									console.log(res);
									if (res.data.code === 1000) {
										this.$message({
											message: '新增成功！',
											type: 'success'
										})
										this.inputData.showDialog = false;
										this.getList(this.commonMsg.searchData);
									} else {
										this.$message({
											message: res.data.message,
											type: 'warning'
										})
									}
								})
							} else {
								this.$message({
									message: '此账号已存在，请更换一个账号名称！',
									type: 'warning'
								})
							}
						} else {
							this.$message({
								message: res.data.message,
								type: 'warning'
							})
						}
					})

				} else if (this.inputData.type == '移交') {
					let params = {
						glyPass: data.glyPass,
						newUserId: data.newUserId,
						oldUserId: this.inputData.userInfo.userId
					};
					this.$telAxios.post('/v1/librarian/updateFlexibileLibrarianByUserId', params).then(res => {
						console.log(res);
						if (res.data.code === 1000) {
							this.$message({
								message: '账号移交成功！',
								type: 'success'
							})
							this.searchData(this.commonMsg.searchData);
						} else {
							this.$message({
								message: res.data.message,
								type: 'warning'
							})
						}
					})
					this.inputData.showDialog = false;
				}

			},
			//打开新增账户/移交账户弹窗
			openInputDialog(type, data) {
				console.log(type);
				console.log(data);
				this.inputData.type = type;
				this.inputData.userInfo = data;
				this.inputData.showDialog = true;
				if (type == '新增') {
					this.inputData.title = '新增电话招聘';
					this.inputData.dialogContent = [{
							title: '姓名',
							value: 'name'
						},
						{
							title: '手机号',
							value: 'telnum'
						},
						{
							title: '账号',
							value: 'accountNumber'
						}
					]
					this.inputData.form = {
						name: '',
						telnum: '',
						accountNumber: ''
					}
					this.inputData.tips = '账号默认密码为admin@123，请工作人员登录并修改';
				} else if (type == '移交') {
					this.inputData.title = '账户数据移交';
					this.inputData.dialogContent = [{
							title: '被交接人账号',
							value: 'transfer'
						},
						{
							title: '管理员密码:',
							value: 'glyPass'
						}
					]
					this.inputData.form = {
						transfer: '',
						glyPass: ''
					}
					this.inputData.tips = '';
				}
			},
			//获取明细/备注列表
			getDetailsList(obj) {
				let params = {
					librarianId: this.detailsData.userInfo.librarianId,
					pageNum: obj.cur,
					pageSize: obj.pageSize
				}
				let url = this.detailsData.type == '明细' ? '/v1/librarian/selectDetailBylibrarianId' :
					'/v1/librarian/selectPostscriptVoList';
				this.$telAxios.post(url, params).then(res => {
					console.log(res);
					if (res.data.code === 1000) {
						let result = res.data.data;
						if (this.detailsData.type == '明细') {
							result.dlist.forEach(item => {
								let mold = '修改类型：';
								if (item.grade == 1) {
									mold += '姓名';
								} else if (item.grade == 2) {
									mold += '手机号';
								} else if (item.grade == 3) {
									mold += '岗位';
								} else if (item.grade == 4) {
									mold += '工作状态';
								} else if (item.grade == 5) {
									mold += '项目归属';
								} else if (item.grade == 6) {
									mold += '标注';
								} else if (item.grade == 7) {
									mold += '备注';
								} else if (item.grade == 8) {
									mold += '简历';
								} else if (item.grade == 10) {
									mold += '性别';
								} else if (item.grade == 11) {
									mold += '年龄';
								} else if (item.grade == 12) {
									mold += '学历';
								} else if (item.grade == 13) {
									mold += '籍贯';
								} else if (item.grade == 14) {
									mold += '现住址';
								} else if (item.grade == 16) {
									mold += '入职时间';
								}
								item.comment = mold + '<br/>' + ' 修改前内容：' + item.changedFront + '<br/>' +
									' 修改后内容：' + item.changedQueen;
							})
							this.detailsData.list = result.dlist;
						} else {
							this.detailsData.list = result.plist;
						}
						this.detailsData.totalNum = Number(result.totalNum);
					} else {
						this.$message({
							message: res.data.message,
							type: 'warning'
						})
					}
				})

			},
			//打开明细/备注弹窗
			openDetailsDialog(type, data) {
				console.log(type);
				console.log(data);
				this.detailsData.type = type;
				this.detailsData.userInfo = data;
				this.detailsData.showDialog = true;
				this.detailsData.title = type == '明细' ? '修改明细' : '备注';
				this.getDetailsList({
					cur: 1,
					pageSize: 10
				});
			},
			//打开添加新备注弹窗
			addRemarks(data) {
				console.log(data);
				this.remarksData.showDialog = true;
				this.remarksData.userInfo = data;
			},
			changeCur(data) {
				this.cur = data
				console.log(data);
			},
			//提交新增备注数据
			subRemarks(data) {
				console.log(data);
				let params = {
					librarianId: this.remarksData.userInfo.librarianId,
					changedFront: this.remarksData.userInfo.newRemarks,
					changedQueen: data,
					grade: 7
				};
				this.$telAxios.post('/v1/librarian/insertDetail', params).then(res => {
					console.log(res);
					if (res.data.code === 1000) {
						this.$message({
							message: '添加备注成功！',
							type: 'success'
						})
						this.$refs.remark.clearData();
						this.searchData(this.commonMsg.searchData);
					} else {
						this.$message({
							message: res.data.message,
							type: 'warning'
						})
					}
				})
				this.remarksData.showDialog = false;
			},
			//打开简历模板
			openResume(data) {
				console.log(data);
				this.remuseData.showDialog = true;
				this.$telAxios.post('/v1/librarian/selectFlexibileResumeList', {
					librarianId: data.librarianId
				}).then(res => {
					console.log(res);
					if (res.data.code === 1000) {
						this.remuseData.list = res.data.data;
					} else {
						this.$message({
							message: res.data.message,
							type: 'warning'
						})
					}
				})
			},


			//当前页是第几页,点击的第几页的时候调用这个函数
			pageChange(p) {
				// 点击的时候传过来一个参数，这个参数就是所点击的当前页数，
				// 然后把这个当前页数转换成字符串形式赋值给page，
				// 然后把page这个参数传给search这个方法
				console.log(p);
				this.cur = p;
				this.getList(this.form)
			},
			//每页有多少条,10,20,50等,点击选择的时候调用这个方法
			handleSizeChange(val) {
				console.log(val);
				this.pageSize = val;
				this.getList(this.form)
			},
		}
	}
</script>

<style scoped="scoped">
	.on-active {
		color: #0064e4 !important;
	}

	.overview /deep/ .caret-wrapper .ascending {
		display: none;
	}

	.overview /deep/.caret-wrapper.descending {
		border-top-color: #C0C4CC;
		bottom: 10px;
	}

	.container {
		background-color: #fff;
		padding-left: 20px;
	}

	.search {
		padding: 10px 15px;
	}

	.search .el-input {
		width: 400px;
	}


	.header-title {
		padding: 10px 0 20px 0;
		border-bottom: 1px solid #D2D2D2;
	}

	.mox {
		width: 15px;
		float: left;
		height: 30px;
		background-color: #0064E4;
		margin-right: 20px;
	}

	.header-title p {
		line-height: 30px;
		float: left;
		font-size: 16px;
		font-family: PingFang SC;
		font-weight: 500;
		color: #000000;
		cursor: pointer;
	}

	.header-title .fr {
		float: right;
		margin-right: 30px;
		cursor: pointer;
		color: #5492CC;
	}

	.pageBox {
		margin-top: 20px;
	}

	.output {
		border: 1px solid cornflowerblue;
		border-radius: 12px;
		padding: 0px 15px;
	}


	/deep/.el-table th {
		height: 46px;
		font-size: 14px;
		color: #727272;
		background-color: rgb(86, 145, 202);
		border: rgb(86, 145, 202);
		color: white !important;
	}

	/deep/.el-table th {
		height: 46px;
		font-size: 12px !important;
		color: #727272;
		background-color: rgb(86, 145, 202);
		border: rgb(86, 145, 202);
	}

	.btn {
		background-color: rgb(86, 145, 202);
	}
</style>
